<template>
  <div class="app-container video">
    <div class="content">
      <div class="item" v-for="(item,index) in list" :key="index" @click="goToContent(item)" v-if="list">
        <span class="video-cover">
        <!-- <span class="video-cover" :style="{backgroundImage:'url('+chioceImg(item.max_file_name)+')'}"> -->
        </span>
        <div class="item-right">
          <span class="title" v-html="item.columnName">李宇春压轴登场啊李宇春压轴登场啊</span>
          <span class="time">2017年6月7日</span>
        </div>
      </div>
      <div v-else>
        <img src="../../../static/images/base/none.png" alt="">
      </div>
    </div>
  </div>
</template>

<script>
import {getNewVideoTwoList } from "@/api/index";
import {GetVideoDetailsList } from "@/api/Api";
export default {
  data() {
    return {
      currentPage: 1,
      total:0,
      list:[]
    };
  },
  components: {},
  created() {
    this.init();
  },
  watch: {
    columnId() {
      this.currentPage = 1;
      this.$router.push(this.$route.path + "?currentPage=" + this.currentPage+"&value=" + this.videotype);
      this.init(this.currentPage);
    }
  },
  computed: {
    videotype() {
      return this.$store.state.videotype;
    },
    columnId(){
      return this.$store.state.columnId;
    }
  },
  methods: {
    init(page, pageSize) {
      GetVideoDetailsList(3,this.videotype)
        .then(res => {
          this.list = res.data
          console.log(res.data);
        })
        .catch(err => {});
    },
    goToContent(item) {
      this.$router.push("/videomusic/video_content?value2="+item.columnId+"&value="+this.videotype+"&title="+item.columnName);
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.$router.push(this.$route.path + "?currentPage=" + this.currentPage);
    },
     chioceImg(item){
      return 'http://cacv.cnki.net/Content/CACV/FM/'+item.substring(0,8)+'/'+item+'.jpg'
    }
  }
};
</script>
<style lang="less" scoped>
.video {
  width: 100%;
  .content {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #eaeaea;
    margin-bottom: 30px;
    .item {
      display: flex;
      cursor: pointer;
      width: 560px;
      margin-top: 20px;
      border-bottom: 1px solid #eaeaea;
      padding-bottom: 24px;
      margin-bottom: -1px;
      .video-cover {
        width: 298px;
        height: 150px;
        background: url("/static/images/base/video-box.png") no-repeat;
        background-size: cover;
        display: block;
        position: relative;
        border-radius: 10px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.4);
        img {
          position: absolute;
          bottom: 10px;
          right: 10px;
        }
      }
      .item-right {
        display: flex;
        flex-direction: column;
        margin-left: 38px;
        flex: 1;
        .title{
          margin-top: 10px;
        }
        .time{
          margin-top: 5px;
        }
      }
    }
    .item:nth-child(2n) {
      padding-left: 38px;
    }
  }
}
</style>


